home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / domacnost a kancelar / autoit / autoit-v3-setup.exe / Include / GuiStatusBar.au3 < prev    next >
Encoding:
Text File  |  2007-09-08  |  38.1 KB  |  798 lines

  1. #include-once
  2. #include <Array.au3>
  3. #include <Misc.au3>
  4. #include <Memory.au3>
  5. #include <StatusBarConstants.au3>
  6. #include <WindowsConstants.au3>
  7. ; ------------------------------------------------------------------------------
  8. ;
  9. ; AutoIt Version: 3.2.3++
  10. ; Language:       English
  11. ; Description:    Functions that assist with the Statusbar control
  12. ;
  13. ; ------------------------------------------------------------------------------
  14.  
  15. ; ------------------------------------------------------------------------------
  16. ; These functions use some code developed by Paul Campbell (PaulIA) for the Auto3Lib project
  17. ; particularly the _Mem* function calls which can be found in Memory.au3
  18. ; ------------------------------------------------------------------------------
  19.  
  20. ;=== Globals
  21. Global $debug = True
  22. Global Const $LowOrder = 0xFFFF
  23. ;=== End Globals
  24.  
  25. ;=== function list
  26. ;===============================================================================
  27. ;_GUICtrlStatusBarCreate
  28. ;_GUICtrlStatusBarCreateProgress
  29. ;_GUICtrlStatusBarDelete
  30. ;_GUICtrlStatusBarGetBorders
  31. ;_GUICtrlStatusBarGetIcon
  32. ;_GUICtrlStatusBarGetParts
  33. ;_GUICtrlStatusBarGetRect
  34. ;_GUICtrlStatusBarGetText
  35. ;_GUICtrlStatusBarGetTextLength
  36. ;_GUICtrlStatusBarGetTip
  37. ;_GUICtrlStatusBarGetUnicode
  38. ;_GUICtrlStatusBarIsSimple
  39. ;_GUICtrlStatusBarResize
  40. ;_GUICtrlStatusBarSetBKColor
  41. ;_GUICtrlStatusBarSetIcon
  42. ;_GUICtrlStatusBarSetMinHeight
  43. ;_GUICtrlStatusBarSetParts
  44. ;_GUICtrlStatusBarSetSimple
  45. ;_GUICtrlStatusBarSetText
  46. ;_GUICtrlStatusBarSetTip
  47. ;_GUICtrlStatusBarSetUnicode
  48. ;_GUICtrlStatusBarShowHide
  49. ;**********Helper**************
  50. ;_CreateStructFromArray
  51. ;********** ToDo **************
  52. ;_GUICtrlStatusBarSetExtendedStyle
  53.  
  54. ;===============================================================================
  55. ;
  56. ; Description:       _GUICtrlStatusBarCreate
  57. ; Parameter(s):      $h_Gui            -    Handle to parent window
  58. ;                    $v_PartWidth    -    width of part or parts (for more than 1 part pass in zero based array)
  59. ;                    v_PartText    -    text of part or parts (for more than 1 part pass in zero based array)
  60. ;                            $v_styles        -    styles to apply to the status bar (Optional) for multiple styles bitor them.
  61. ; Requirement:
  62. ; Return Value(s):   Returns hWhnd if successful, or 0 with error set to 1 otherwise.
  63. ; User CallTip:      _GUICtrlStatusBarCreate($h_Gui, $a_PartWidth, $s_PartText[, $v_styles = ""]) Creates Statusbar. (required: <GuiStatusBar.au3>)
  64. ; Author(s):         rysiora, JdeB, tonedef,
  65. ;                    gafrost (Gary Frost (custompcs at charter dot net)), Steve Podhajecki <gehossafats at netmdc dot com>
  66. ; Note(s):
  67. ;===============================================================================
  68. Func _GUICtrlStatusBarCreate($h_Gui, $a_PartWidth, $s_PartText, $v_styles = "")
  69.     Local $a_PW[1], $a_PT[1]
  70.     If IsArray($a_PartWidth) Then
  71.         $a_PW = $a_PartWidth
  72.     Else
  73.         $a_PW[0] = $a_PartWidth
  74.     EndIf
  75.     If IsArray($s_PartText) Then
  76.         $a_PT = $s_PartText
  77.     Else
  78.         $a_PT[0] = $s_PartText
  79.     EndIf
  80.     If UBound($a_PW) <> UBound($a_PT) Then Return SetError(-1, -1, 0)
  81.     If Not IsHWnd($h_Gui) Then $h_Gui = HWnd($h_Gui)
  82.     Local $hwnd_Bar1, $x
  83.     Local $style = BitOR($WS_CHILD, $WS_VISIBLE)
  84.     If @NumParams = 4 Then $style = BitOR($style, $v_styles)
  85.  
  86. ;~     $hwnd_Bar1 = DllCall("comctl32.dll", "long", "CreateStatusWindow", "long", $style, "str", "", "hwnd", $h_Gui, "int", 0)
  87.     $hwnd_Bar1 = DllCall("user32.dll", "long", "CreateWindowEx", "long", 0, _
  88.             "str", "msctls_statusbar32", "str", "", _
  89.             "long", $style, "long", 0, "long", 0, "long", 0, "long", 0, _
  90.             "hwnd", $h_Gui, "long", 0, "hwnd", $h_Gui, "long", 0)
  91.     
  92.     If @error Then Return SetError(1, 1, 0)
  93.     _GUICtrlStatusBarSetParts($h_Gui, $hwnd_Bar1[0], UBound($a_PW), $a_PW)
  94.     For $x = 0 To UBound($s_PartText) - 1
  95.         _GUICtrlStatusBarSetText($hwnd_Bar1[0], $a_PT[$x], $x)
  96.     Next
  97.     
  98.     Return HWnd($hwnd_Bar1[0])
  99. EndFunc   ;==>_GUICtrlStatusBarCreate
  100.  
  101. ;===============================================================================
  102. ;
  103. ; Description:       _GUICtrlStatusBarCreateProgress
  104. ; Parameter(s):      $h_StatusBar    -    Controld Id of status bar
  105. ;                    $i_Part        -    Optional: Part of the status bar to create the progress in (Default 0)
  106. ;                    $v_styles        -    Optional: Styles to apply to the progress bar for multiple styles bitor them.
  107. ; Requirement:
  108. ; Return Value(s):   Returns Control Id if successful, or if error is set to -1 and -1 is returned.
  109. ; User CallTip:      _GUICtrlStatusBarCreateProgress($h_StatusBar[, $i_Part = 0[, $v_styles = ""]]) Creates ProgressBar in Statusbar part. (required: <GuiStatusBar.au3>)
  110. ; Author(s):         eltorro, RagnaroktA,
  111. ;                    gafrost (Gary Frost (custompcs at charter dot net))
  112. ; Note(s):
  113. ;===============================================================================
  114. Func _GUICtrlStatusBarCreateProgress($h_StatusBar, $i_Part, $v_styles = "")
  115.     If Not _IsClassName ($h_StatusBar, "msctls_statusbar32") Then Return SetError(-1, -1, -1)
  116.     Local $i_pad = 2, $a_box[4], $v_ret
  117.     If _GUICtrlStatusBarIsSimple($h_StatusBar) Then
  118.         Local $i_parts = _GUICtrlStatusBarGetParts($h_StatusBar)
  119.         _GUICtrlStatusBarSetSimple($h_StatusBar, False)
  120.         $v_ret = _GUICtrlStatusBarGetRect($h_StatusBar, 0)
  121.         $a_box[0] = $v_ret[0]; left
  122.         $a_box[1] = $v_ret[1]; top
  123.         $a_box[3] = $v_ret[3]; height
  124.         $v_ret = _GUICtrlStatusBarGetRect($h_StatusBar, $i_parts - 1)
  125.         $a_box[2] = $v_ret[2]; width
  126.         _GUICtrlStatusBarSetSimple($h_StatusBar, True)
  127.     Else
  128.         If _GUICtrlStatusBarGetParts($h_StatusBar) - 1 < $i_Part Or $i_Part < 0 Then Return SetError(-1, -1, -1)
  129.         $a_box = _GUICtrlStatusBarGetRect($h_StatusBar, $i_Part)
  130.     EndIf
  131.     ; Shrink the rect a little to fit inside panel
  132.     $a_box[0] = $a_box[0] + $i_pad; left
  133.     $a_box[1] = $a_box[1] + $i_pad; top
  134.     $a_box[2] = $a_box[2] - $a_box[0] - $i_pad; width
  135.     $a_box[3] = $a_box[3] - $a_box[1] - $i_pad; height
  136.  
  137.     ; Create the progress bar with the proper size.
  138.     Local $Progress1 = GUICtrlCreateProgress($a_box[0], $a_box[1], $a_box[2], $a_box[3], $v_styles)
  139.     GUICtrlSetResizing($Progress1, 802) ; dock all
  140.  
  141.     ; Change progressbars parent to statusbar
  142.     If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
  143.     Local $h_Progress = GUICtrlGetHandle($Progress1)
  144.     $v_ret = DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $h_Progress, "hwnd", $h_StatusBar)
  145.     If Not IsHWnd($v_ret[0]) Then Return SetError(-1, -1, -1)
  146.  
  147.     Return $Progress1
  148. EndFunc   ;==>_GUICtrlStatusBarCreateProgress
  149.  
  150. ;===============================================================================
  151. ;
  152. ; Description:       _GUICtrlStatusBarDelete
  153. ; Parameter(s):      hwnd    -    Handle to statusbar
  154. ; Requirement:
  155. ; Return Value(s):   If the function succeeds, the return value is nonzero
  156. ;                    If the function fails, the return value is zero
  157. ; User CallTip:      _GUICtrlStatusBarDelete(hwnd) Deletes the StatusBar control. (required: <GuiStatusBar.au3>)
  158. ; Author(s):         gafrost (Gary Frost (custompcs at charter dot net))
  159. ; Note(s):
  160. ;===============================================================================
  161. Func _GUICtrlStatusBarDelete($h_StatusBar)
  162.     If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
  163.     If Not _IsClassName ($h_StatusBar, "msctls_statusbar32") Then Return SetError(-1, -1, 0)
  164.     Local $v_ret = DllCall("user32.dll", "int", "DestroyWindow", "hwnd", HWnd($h_StatusBar))
  165.     If Not @error And IsArray($v_ret) Then Return $v_ret[0]
  166.     Return SetError(1, 1, 0)
  167. EndFunc   ;==>_GUICtrlStatusBarDelete
  168.  
  169. ;===============================================================================
  170. ;
  171. ; Description:       _GUICtrlStatusBarGetBorders
  172. ; Parameter(s):      $h_StatusBar    -    Handle to statusbar
  173. ; Requirement:
  174. ; Return Value(s):   Returns zero based array
  175. ;                       0 - width of the horizontal border
  176. ;                       1 - width of the vertical border
  177. ;                       2 - width of the border between rectangles
  178. ;                    or zero otherwise.
  179. ; User CallTip:      _GUICtrlStatusBarGetBorders($h_StatusBar) Retrieves the current widths of the horizontal and vertical borders of a status window. (required: <GuiStatusBar.au3>)
  180. ; Author(s):         gafrost (Gary Frost (custompcs at charter dot net))
  181. ; Note(s):
  182. ;===============================================================================
  183. Func _GUICtrlStatusBarGetBorders($h_StatusBar)
  184.     Local $ret
  185.     Local $borders_struct = DllStructCreate("int;int;int")
  186.     Local $borders_struct_pointer = DllStructGetPtr($borders_struct)
  187.     If @error Then Return SetError(@error, @error, 0)
  188.     If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
  189.     If Not _IsClassName ($h_StatusBar, "msctls_statusbar32") Then Return SetError(-1, -1, 0)
  190.     Local $struct_MemMap
  191.     Local $i_Size = DllStructGetSize($borders_struct)
  192.     Local $Memory_pointer = _MemInit ($h_StatusBar, $i_Size, $struct_MemMap)
  193.     If @error Then
  194.         _MemFree ($struct_MemMap)
  195.         Return SetError(-1, -1, 0)
  196.     EndIf
  197.     $ret = _SendMessage($h_StatusBar, $SB_GETBORDERS, 0, $Memory_pointer, 0, "int", "ptr")
  198.     If @error Then
  199.         _MemFree ($struct_MemMap)
  200.         Return SetError(-1, -1, 0)
  201.     EndIf
  202.     _MemRead ($struct_MemMap, $Memory_pointer, $borders_struct_pointer, $i_Size)
  203.     If @error Then
  204.         _MemFree ($struct_MemMap)
  205.         Return SetError(-1, -1, 0)
  206.     EndIf
  207.     _MemFree ($struct_MemMap)
  208.     If @error Then Return SetError(-1, -1, 0)
  209.     If (Not $ret) Then
  210.         Return SetError(-1, -1, 0)
  211.     Else
  212.         Local $a_borders[3], $x
  213.         For $x = 0 To 2
  214.             $a_borders[$x] = DllStructGetData($borders_struct, $x + 1)
  215.         Next
  216.         Return $a_borders
  217.     EndIf
  218. EndFunc   ;==>_GUICtrlStatusBarGetBorders
  219.  
  220. ;===============================================================================
  221. ;
  222. ; Description:       _GUICtrlStatusBarGetIcon
  223. ; Parameter(s):      $h_StatusBar    -    The Control Id (will be converted to hWnd)
  224. ;                    $i_Part            -    The part to hold the text
  225. ; Requirement:
  226. ; Return Value(s):   return hwnd or zero otherwise.
  227. ; User CallTip:      _GUICtrlStatusBarGetIcon($h_StatusBar[, $i_Part=0]) Retrieves the icon for a part in a status bar. (required: <GuiStatusBar.au3>)
  228. ; Author(s):         Steve Podhajecki <gehossafats at netmdc dotcom>, gafrost (Gary Frost (custompcs at charter dot net))
  229. ; Note(s):
  230. ;===============================================================================
  231. Func _GUICtrlStatusBarGetIcon($h_StatusBar, $i_Part = 0)
  232.     If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
  233.     If Not _IsClassName ($h_StatusBar, "msctls_statusbar32") Then Return SetError(-1, -1, 0)
  234.     Return _SendMessage($h_StatusBar, $SB_GETICON, $i_Part)
  235. EndFunc   ;==>_GUICtrlStatusBarGetIcon
  236.  
  237. ;===============================================================================
  238. ;
  239. ; Description:       _GUICtrlStatusBarGetParts
  240. ; Parameter(s):      $h_StatusBar    -    The Control Id (will be converted to hWnd)
  241. ;
  242. ; Requirement:
  243. ; Return Value(s):   Returns the number of parts in the window, otherwise zero.
  244. ; User CallTip:      _GUICtrlStatusBarGetParts($h_StatusBar) Retrieves a count of the parts in a status window. (required: <GuiStatusBar.au3>)
  245. ; Author(s):         Steve Podhajecki <gehossafats at netmdc dot com>, gafrost (Gary Frost (custompcs at charter dot net))
  246. ;
  247. ; Note(s):
  248. ;===============================================================================
  249. Func _GUICtrlStatusBarGetParts($h_StatusBar)
  250.     If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
  251.     If Not _IsClassName ($h_StatusBar, "msctls_statusbar32") Then Return SetError(-1, -1, 0)
  252.     Return _SendMessage($h_StatusBar, $SB_GETPARTS)
  253. EndFunc   ;==>_GUICtrlStatusBarGetParts
  254.  
  255. ;===============================================================================
  256. ;
  257. ; Description:       _GUICtrlStatusBarGetRect
  258. ; Parameter(s):      $h_StatusBar    -    Handle to statusbar
  259. ;                    $i_part         -    zero based index of part to retrieve rectangle from
  260. ; Requirement:
  261. ; Return Value(s):   Returns zero based array
  262. ;                       0 - Left
  263. ;                       1 - Top
  264. ;                       2 - Right
  265. ;                       3 - Bottom
  266. ;                    zero otherwise.
  267. ; User CallTip:      _GUICtrlStatusBarGetRect($StatusBar[, $i_part = 0]) Retrieves the bounding rectangle of a part in a status window. (required: <GuiStatusBar.au3>)
  268. ; Author(s):         gafrost (Gary Frost (custompcs at charter dot net))
  269. ; Note(s):
  270. ;===============================================================================
  271. Func _GUICtrlStatusBarGetRect($h_StatusBar, $i_Part = 0)
  272. ;~     typedef struct _RECT {
  273. ;~       LONG left;
  274. ;~       LONG top;
  275. ;~       LONG right;
  276. ;~       LONG bottom;
  277. ;~     } RECT, *PRECT;
  278.     Local $ret
  279.     If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
  280.     If Not _IsClassName ($h_StatusBar, "msctls_statusbar32") Then Return SetError(-1, -1, -1)
  281.     Local $RECT_struct = DllStructCreate("int;int;int;int")
  282.     If @error Then Return SetError(-1, -1, 0)
  283.     Local $RECT_struct_pointer = DllStructGetPtr($RECT_struct)
  284.     If @error Then Return SetError(@error, @error, 0)
  285.     Local $struct_MemMap
  286.     Local $i_Size = DllStructGetSize($RECT_struct)
  287.     Local $Memory_pointer = _MemInit ($h_StatusBar, $i_Size, $struct_MemMap)
  288.     If @error Then
  289.         _MemFree ($struct_MemMap)
  290.         Return SetError(-1, -1, 0)
  291.     EndIf
  292.     $ret = _SendMessage($h_StatusBar, $SB_GETRECT, $i_Part, $Memory_pointer, 0, "int", "ptr")
  293.     If @error Then
  294.         _MemFree ($struct_MemMap)
  295.         Return SetError(-1, -1, 0)
  296.     EndIf
  297.     _MemRead ($struct_MemMap, $Memory_pointer, $RECT_struct_pointer, $i_Size)
  298.     If @error Then
  299.         _MemFree ($struct_MemMap)
  300.         Return SetError(-1, -1, 0)
  301.     EndIf
  302.     _MemFree ($struct_MemMap)
  303.     If @error Then Return SetError(-1, -1, 0)
  304.     If Not $ret Then
  305.         Return SetError(-1, -1, 0)
  306.     Else
  307.         Local $a_rect[4], $x
  308.         For $x = 0 To 3
  309.             $a_rect[$x] = DllStructGetData($RECT_struct, $x + 1)
  310.         Next
  311.         Return $a_rect
  312.     EndIf
  313. EndFunc   ;==>_GUICtrlStatusBarGetRect
  314.  
  315. ;===============================================================================
  316. ;
  317. ; Description:       _GUICtrlStatusBarGetText
  318. ; Parameter(s):      $h_StatusBar    -    The Control Id (will be converted to hWnd)
  319. ;                    $i_Part        -    The part to retreive the text from
  320. ; Requirement:
  321. ; Return Value(s):   Text from part
  322. ; User CallTip:      _GUICtrlStatusBarGetText($h_StatusBar[,$i_Part=0]) Retrieves the text from the specified part of a status window. (required: <GuiStatusBar.au3>)
  323. ; Author(s):         tonedef, gafrost (Gary Frost (custompcs at charter dot net)), Steve Podhajecki <gehossafats@netmdc.com>
  324. ; Note(s):
  325. ;===============================================================================
  326. Func _GUICtrlStatusBarGetText($h_StatusBar, $i_Part = 0)
  327.     ;== there is a built in function to use for this. See help documentation
  328.     If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
  329.     If Not _IsClassName ($h_StatusBar, "msctls_statusbar32") Then Return SetError(-1, -1, "")
  330.     Local $struct_String = DllStructCreate("char[4096]")
  331.     Local $sBuffer_pointer = DllStructGetPtr($struct_String)
  332.     Local $i_Size = DllStructGetSize($struct_String)
  333.     Local $struct_MemMap
  334.     Local $Memory_pointer = _MemInit ($h_StatusBar, $i_Size + 4096, $struct_MemMap)
  335.     If @error Then
  336.         _MemFree ($struct_MemMap)
  337.         Return SetError(-1, -1, "")
  338.     EndIf
  339.  
  340. ;~     Local $v_ret = DllCall("user32.dll", "int", "SendMessageA", "hwnd", $h_StatusBar, "int", $SB_GETTEXT, "int", $i_Part, "ptr", $Memory_pointer)
  341.     _SendMessage($h_StatusBar, $SB_GETTEXT, $i_Part, $Memory_pointer)
  342.     If @error Then
  343.         _MemFree ($struct_MemMap)
  344.         Return SetError(-1, -1, "")
  345.     EndIf
  346.     _MemRead ($struct_MemMap, $Memory_pointer, $sBuffer_pointer, 4096)
  347.     If @error Then
  348.         _MemFree ($struct_MemMap)
  349.         Return SetError(-1, -1, "")
  350.     EndIf
  351.     _MemFree ($struct_MemMap)
  352.     If @error Then Return SetError(-1, -1, "")
  353.     Return DllStructGetData($struct_String, 1)
  354. EndFunc   ;==>_GUICtrlStatusBarGetText
  355.  
  356. ;===============================================================================
  357. ;
  358. ; Description:       _GUICtrlStatusBarGetTextLength
  359. ; Parameter(s):      $h_StatusBar    -    The Control Id (will be converted to hWnd)
  360. ;                    $i_Part        -    Nubmer of the part to retrieve length from
  361. ;
  362. ; Requirement:
  363. ; Return Value(s):   Text Length
  364. ; User CallTip:      _GUICtrlStatusBarGetTextLength ($h_StatusBar[, $i_Part = 0]) Retrieves the length, in characters, of the text from the specified part of a status window. (required: <GuiStatusBar.au3>)
  365. ; Author(s):         Steve Podhajecki <gehossafats@netmdc.com>, gafrost (Gary Frost (custompcs at charter dot net))
  366. ; Note(s):
  367. ;===============================================================================
  368. Func _GUICtrlStatusBarGetTextLength($h_StatusBar, $i_Part = 0)
  369.     If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
  370.     If Not _IsClassName ($h_StatusBar, "msctls_statusbar32") Then Return SetError(-1, -1, -1)
  371.     Return _SendMessage($h_StatusBar, $SB_GETTEXTLENGTH, $i_Part)
  372. EndFunc   ;==>_GUICtrlStatusBarGetTextLength
  373.  
  374. ;===============================================================================
  375. ;
  376. ; Description:       _GUICtrlStatusBarGetTip
  377. ; Parameter(s):      $h_StatusBar    -    The Control Id (will be converted to hWnd)
  378. ;                    $i_Part            -    The part to retreive the text from
  379. ; Requirement:
  380. ; Return Value(s):   Tip Text, on error empty string and @error is set to -1
  381. ; User CallTip:      _GUICtrlStatusBarGetTip($h_StatusBar[, $i_Part=0]) Retrieves the ToolTip text for a part in a status bar. (required: <GuiStatusBar.au3>)
  382. ; Author(s):         Steve Podhajecki <gehossafats@netmdc.com>, , gafrost (Gary Frost (custompcs at charter dot net))
  383. ; Note(s):           The status bar must be created with the $SBT_TOOLTIPS style to enable ToolTips.
  384. ;===============================================================================
  385. Func _GUICtrlStatusBarGetTip($h_StatusBar, $i_Part = 0)
  386.     If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
  387.     If Not _IsClassName ($h_StatusBar, "msctls_statusbar32") Then Return SetError(-1, -1, -1)
  388.     Local $struct_String = DllStructCreate("char[255]")
  389.     Local $sBuffer_pointer = DllStructGetPtr($struct_String)
  390.     Local $i_Size = DllStructGetSize($struct_String)
  391.     Local $wParam = (($i_Size * 0x10000) + $i_Part)
  392.     Local $struct_MemMap
  393.     Local $Memory_pointer = _MemInit ($h_StatusBar, $i_Size + 255, $struct_MemMap)
  394.     If @error Then
  395.         _MemFree ($struct_MemMap)
  396.         Return SetError(-1, -1, "")
  397.     EndIf
  398.  
  399. ;~     Local $v_ret = DllCall("user32.dll", "int", "SendMessageA", "hwnd", $h_StatusBar, "int", $SB_GETTIPTEXT, "long", $wParam, "ptr", $Memory_pointer)
  400.     _SendMessage($h_StatusBar, $SB_GETTIPTEXT, $wParam, $Memory_pointer, 0, "long", "ptr")
  401.     If @error Then
  402.         _MemFree ($struct_MemMap)
  403.         Return SetError(-1, -1, "")
  404.     EndIf
  405.     _MemRead ($struct_MemMap, $Memory_pointer, $sBuffer_pointer, 255)
  406.     If @error Then
  407.         _MemFree ($struct_MemMap)
  408.         Return SetError(-1, -1, "")
  409.     EndIf
  410.     _MemFree ($struct_MemMap)
  411.     If @error Then Return SetError(-1, -1, "")
  412.     Return StringStripWS(DllStructGetData($struct_String, 1), 7);strip leading, trailing, and double ws.
  413. EndFunc   ;==>_GUICtrlStatusBarGetTip
  414.  
  415. ;===============================================================================
  416. ;
  417. ; Description:       _GUICtrlStatusBarGetUnicode
  418. ; Parameter(s):      $h_StatusBar    -    The Control Id (will be converted to hWnd)
  419. ;
  420. ; Requirement:
  421. ; Return Value(s):   If this value is nonzero, the control is using Unicode characters.
  422. ;                    If this value is zero, the control is using ANSI characters
  423. ; User CallTip:      _GUICtrlStatusBarGetUnicode ($h_StatusBar) Retrieves the Unicode character format flag for the control. (required: <GuiStatusBar.au3>)
  424. ; Author(s):         gafrost (Gary Frost (custompcs at charter dot net))
  425. ; Note(s):
  426. ;===============================================================================
  427. Func _GUICtrlStatusBarGetUnicode($h_StatusBar)
  428.     If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
  429.     If Not _IsClassName ($h_StatusBar, "msctls_statusbar32") Then Return SetError(-1, -1, 0)
  430.     Return _SendMessage($h_StatusBar, $SB_GETUNICODEFORMAT)
  431. EndFunc   ;==>_GUICtrlStatusBarGetUnicode
  432.  
  433. ;===============================================================================
  434. ;
  435. ; Description:       _GUICtrlStatusBarIsSimple
  436. ; Parameter(s):      $h_StatusBar    -    Handle to statusbar
  437. ; Requirement:
  438. ; Return Value(s):   non zero    - if a simple statusbar
  439. ;                            zero        - if not a simple statusbar
  440. ; User CallTip:      _GUICtrlStatusBarIsSimple($h_StatusBar) Checks a status bar control to determine if it is in simple mode. (required: <GuiStatusBar.au3>)
  441. ; Author(s):         gafrost (Gary Frost (custompcs at charter dot net))
  442. ; Note(s):
  443. ;===============================================================================
  444. Func _GUICtrlStatusBarIsSimple($h_StatusBar)
  445.     If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
  446.     If Not _IsClassName ($h_StatusBar, "msctls_statusbar32") Then Return SetError(-1, -1, 0)
  447.     Return _SendMessage($h_StatusBar, $SB_ISSIMPLE)
  448. EndFunc   ;==>_GUICtrlStatusBarIsSimple
  449.  
  450. ;===============================================================================
  451. ;
  452. ; Description:       _GUICtrlStatusBarResize
  453. ; Parameter(s):      $h_StatusBar    -    The Control Id (will be converted to hWnd)
  454. ;
  455. ; Requirement:
  456. ; Return Value(s):   If the function succeeds, the return value is nonzero, otherwise zero.
  457. ; User CallTip:      _GUICtrlStatusBarResize($h_StatusBar)    Resize Statusbar. (required: <GuiStatusBar.au3>)
  458. ; Author(s):         Steve Podhajecki <gehossafats@netmdc.com>
  459. ; Note(s):
  460. ;===============================================================================
  461. Func _GUICtrlStatusBarResize($h_StatusBar)
  462.     If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
  463.     If Not _IsClassName ($h_StatusBar, "msctls_statusbar32") Then Return SetError(-1, -1, 0)
  464.     Local $ret = DllCall("user32.dll", "int", "MoveWindow", "hwnd", $h_StatusBar, "int", 0, "int", 0, "int", 0, "int", 0, "int", 1)
  465.     If IsArray($ret) Then
  466.         Return $ret[0]
  467.     Else
  468.         Return SetError(-1, -1, 0)
  469.     EndIf
  470. EndFunc   ;==>_GUICtrlStatusBarResize
  471.  
  472. ;===============================================================================
  473. ;
  474. ; Description:       _GUICtrlStatusBarSetBKColor
  475. ; Parameter(s):      $h_StatusBar    -    Handle to statusbar
  476. ;                    $v_HexRGB       -    Hex RGB color to set Status Bar background
  477. ; Requirement:
  478. ; Return Value(s):   Returns the previous background color or zero upon failure
  479. ; User CallTip:      _GUICtrlStatusBarSetBKColor($h_StatusBar, $v_HexRGB) Sets the background color in a status bar. (required: <GuiStatusBar.au3>)
  480. ; Author(s):         gafrost (Gary Frost (custompcs at charter dot net))
  481. ; Note(s):
  482. ;===============================================================================
  483. Func _GUICtrlStatusBarSetBKColor($h_StatusBar, $v_HexRGB)
  484.     If Not _IsClassName ($h_StatusBar, "msctls_statusbar32") Then Return SetError(-1, -1, 0)
  485.     Local Const $CLR_DEFAULT = 0xFF000000
  486.     Local $tc, $ret
  487.     If $v_HexRGB = $CLR_DEFAULT Then
  488.         $ret = _SendMessage($h_StatusBar, $SB_SETBKCOLOR, 0, $CLR_DEFAULT)
  489.     Else
  490.         $tc = Hex(String($v_HexRGB), 6)
  491.         $ret = _SendMessage($h_StatusBar, $SB_SETBKCOLOR, 0, '0x' & StringMid($tc, 5, 2) & StringMid($tc, 3, 2) & StringMid($tc, 1, 2))
  492.     EndIf
  493.     If @error Then Return SetError(-1, -1, 0)
  494.     If $ret = $CLR_DEFAULT Then Return $CLR_DEFAULT
  495.     $tc = Hex(String($ret), 6)
  496.     Return '0x' & StringMid($tc, 5, 2) & StringMid($tc, 3, 2) & StringMid($tc, 1, 2)
  497. EndFunc   ;==>_GUICtrlStatusBarSetBKColor
  498.  
  499. ;===============================================================================
  500. ;
  501. ; Description:       _GUICtrlStatusBarSetIcon
  502. ; Parameter(s):      $h_StatusBar    -    Handle to statusbar
  503. ;                    $i_part         -    Nubmer of part to add icon too
  504. ;                    $s_IconFile     -    file to extract icon from
  505. ;                    $i_iconID       -    id of the icon
  506. ; Requirement:
  507. ; Return Value(s):   Returns nonzero if successful, or zero otherwise.
  508. ; User CallTip:      _GUICtrlStatusBarSetIcon($StatusBar, $i_part, $szIconFile, $iconID) Sets the icon for a part in a status bar. (required: <GuiStatusBar.au3>)
  509. ; Author(s):         gafrost (Gary Frost ([email="custompcs at charter dot net"]custompcs at charter dot net[/email]))
  510. ; Note(s):    To remove the icon from a part use -1 for $i_iconID
  511. ;       If using simple status bar then set $i_part to 255
  512. ;===============================================================================
  513. Func _GUICtrlStatusBarSetIcon($h_StatusBar, $i_Part, $s_IconFile = "", $i_iconID = -1)
  514.     Local $hIcon, $result
  515.     If $i_Part = 255 Then $i_Part = -1
  516.     If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
  517.     If Not _IsClassName ($h_StatusBar, "msctls_statusbar32") Then Return SetError(-1, -1, 0)
  518.     If $i_iconID = -1 Then
  519.         Return _SendMessage($h_StatusBar, $SB_SETICON, $i_Part, $i_iconID, 0, "int", "hwnd")
  520.     Else
  521.         $hIcon = DllStructCreate("int")
  522.         $result = DllCall("shell32.dll", "int", "ExtractIconEx", "str", $s_IconFile, "int", $i_iconID, "hwnd", 0, "ptr", DllStructGetPtr($hIcon), "int", 1)
  523.         $result = $result[0]
  524.         If $result > 0 Then $result = _SendMessage($h_StatusBar, $SB_SETICON, $i_Part, DllStructGetData($hIcon, 1), 0, "int", "hwnd")
  525.         DllCall("user32.dll", "int", "DestroyIcon", "hwnd", DllStructGetPtr($hIcon, 1))
  526.         $hIcon = 0
  527.         Return $result
  528.     EndIf
  529. EndFunc   ;==>_GUICtrlStatusBarSetIcon
  530.  
  531. ;===============================================================================
  532. ;
  533. ; Description:       _GUICtrlStatusBarSetMinHeight
  534. ; Parameter(s):      $h_StatusBar    -    Handle to statusbar
  535. ;                    $i_MinHeight    -    Minimum height, in pixels, of the window
  536. ; Requirement:
  537. ; Return Value(s):   None
  538. ; User CallTip:      _GUICtrlStatusBarSetMinHeight($h_StatusBar, $i_MinHeight) Sets the minimum height of a status window's drawing area. (required: <GuiStatusBar.au3>)
  539. ; Author(s):         gafrost (Gary Frost (custompcs at charter dot net))
  540. ; Note(s):
  541. ;===============================================================================
  542. Func _GUICtrlStatusBarSetMinHeight($h_StatusBar, $i_MinHeight)
  543.     If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
  544.     If Not _IsClassName ($h_StatusBar, "msctls_statusbar32") Then Return SetError(-1, -1, 0)
  545.     _SendMessage($h_StatusBar, $SB_SETMINHEIGHT, $i_MinHeight)
  546.     _GUICtrlStatusBarResize($h_StatusBar)
  547. EndFunc   ;==>_GUICtrlStatusBarSetMinHeight
  548.  
  549. ;===============================================================================
  550. ;
  551. ; Description:       _GUICtrlStatusBarSetSimple
  552. ; Parameter(s):      $h_StatusBar    -    Handle to statusbar
  553. ;                    $b_Simple       -    Display type flag.
  554. ;                        If this parameter is TRUE, the window displays simple text. (Default)
  555. ;                        If it is FALSE, it displays multiple parts
  556. ; Requirement:
  557. ; Return Value(s):   None
  558. ; User CallTip:      _GUICtrlStatusBarSetSimple($h_StatusBar[, $b_Simple = True]) Specifies whether a status window displays simple text or displays all window parts. (required: <GuiStatusBar.au3>)
  559. ; Author(s):         gafrost (Gary Frost (custompcs at charter dot net))
  560. ; Note(s):
  561. ;===============================================================================
  562. Func _GUICtrlStatusBarSetSimple($h_StatusBar, $b_Simple = True)
  563.     If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
  564.     If Not _IsClassName ($h_StatusBar, "msctls_statusbar32") Then Return SetError(-1, -1, 0)
  565.     _SendMessage($h_StatusBar, $SB_SIMPLE, $b_Simple)
  566. EndFunc   ;==>_GUICtrlStatusBarSetSimple
  567.  
  568. ;===============================================================================
  569. ;
  570. ; Description:       _GUICtrlStatusBarSetText
  571. ; Parameter(s):      $h_StatusBar    -    The Control Id (will be converted to hWnd)
  572. ;                    $s_Data         -    The text to display in the part
  573. ;                    $i_Part        -    The part to hold the text (Default: 0)
  574. ; Requirement:
  575. ; Return Value(s):   Returns TRUE if successful, or FALSE otherwise.
  576. ; User CallTip:      _GUICtrlStatusBarSetText($h_StatusBar[, $s_Data = ""[, $i_Part = 0]]) Sets the text in the specified part of a status window. (required: <GuiStatusBar.au3>)
  577. ; Author(s):         rysiora, JdeB, tonedef,
  578. ;                    gafrost (Gary Frost (custompcs at charter dot net))
  579. ; Note(s):           Set $i_Part to 255 for simple statusbar
  580. ;===============================================================================
  581. Func _GUICtrlStatusBarSetText($h_StatusBar, $s_Data = "", $i_Part = 0)
  582.     If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
  583.     If Not _IsClassName ($h_StatusBar, "msctls_statusbar32") Then Return SetError(-1, -1, False)
  584.     Local $struct_String = DllStructCreate("char[" & StringLen($s_Data) + 1 & "]")
  585.     Local $sBuffer_pointer = DllStructGetPtr($struct_String)
  586.     Local $struct_MemMap
  587.     Local $Memory_pointer = _MemInit ($h_StatusBar, StringLen($s_Data) + 1, $struct_MemMap)
  588.     If @error Then
  589.         _MemFree ($struct_MemMap)
  590.         Return SetError(-1, -1, 0)
  591.     EndIf
  592.     DllStructSetData($struct_String, 1, $s_Data)
  593.     If @error Then
  594.         _MemFree ($struct_MemMap)
  595.         Return SetError(-1, -1, 0)
  596.     EndIf
  597.     _MemWrite ($struct_MemMap, $sBuffer_pointer)
  598.     If @error Then
  599.         _MemFree ($struct_MemMap)
  600.         Return SetError(-1, -1, 0)
  601.     EndIf
  602. ;~     Local $ret = DllCall("user32.dll", "int", "SendMessageA", "hwnd", $h_StatusBar, "int", $SB_SETTEXT, "long", $i_Part, "ptr", $Memory_pointer)
  603.     Local $ret = _SendMessage($h_StatusBar, $SB_SETTEXT, $i_Part, $Memory_pointer)
  604.     If @error Then
  605.         _MemFree ($struct_MemMap)
  606.         Return SetError(-1, -1, 0)
  607.     EndIf
  608.     _MemFree ($struct_MemMap)
  609.     Return $ret
  610. EndFunc   ;==>_GUICtrlStatusBarSetText
  611.  
  612. ;===============================================================================
  613. ;
  614. ; Description:       _GUICtrlStatusBarSetTip
  615. ; Parameter(s):      $h_StatusBar    -    Handle to statusbar
  616. ;                    $i_part         -    Zero-based index of the part that will receive the ToolTip text
  617. ;                    $s_ToolTip      -    new ToolTip text
  618. ; Requirement:
  619. ; Return Value(s):   None
  620. ; User CallTip:      _GUICtrlStatusBarSetTip($h_StatusBar, $i_part, $s_ToolTip) Sets the ToolTip text for a part in a status bar. (required: <GuiStatusBar.au3>)
  621. ; Author(s):         gafrost (Gary Frost (custompcs at charter dot net))
  622. ; Note(s):
  623. ;===============================================================================
  624. Func _GUICtrlStatusBarSetTip($h_StatusBar, $i_Part, $s_ToolTip)
  625.     If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
  626.     If Not _IsClassName ($h_StatusBar, "msctls_statusbar32") Then Return SetError(-1, -1, 0)
  627.     Local $struct_String = DllStructCreate("char[" & StringLen($s_ToolTip) + 1 & "]")
  628.     Local $sBuffer_pointer = DllStructGetPtr($struct_String)
  629.     Local $struct_MemMap
  630.     Local $Memory_pointer = _MemInit ($h_StatusBar, StringLen($s_ToolTip) + 1, $struct_MemMap)
  631.     If @error Then
  632.         _MemFree ($struct_MemMap)
  633.         Return SetError(-1, -1, 0)
  634.     EndIf
  635.     DllStructSetData($struct_String, 1, $s_ToolTip)
  636.     If @error Then
  637.         _MemFree ($struct_MemMap)
  638.         Return SetError(-1, -1, 0)
  639.     EndIf
  640.     _MemWrite ($struct_MemMap, $sBuffer_pointer)
  641.     If @error Then
  642.         _MemFree ($struct_MemMap)
  643.         Return SetError(-1, -1, 0)
  644.     EndIf
  645.     _SendMessage($h_StatusBar, $SB_SETTIPTEXT, $i_Part, $Memory_pointer)
  646.     If @error Then
  647.         _MemFree ($struct_MemMap)
  648.         Return SetError(-1, -1, 0)
  649.     EndIf
  650.     _MemFree ($struct_MemMap)
  651. EndFunc   ;==>_GUICtrlStatusBarSetTip
  652.  
  653. ;===============================================================================
  654. ;
  655. ; Description:       _GUICtrlStatusBarSetUnicode
  656. ; Parameter(s):      $h_StatusBar    -    Handle to statusbar
  657. ;                    $b_Unicode        -    Determines the character set that is used by the control.
  658. ;                        If this value is TRUE, the control will use Unicode characters. (Default)
  659. ;                        If this value is FALSE, the control will use ANSI characters.
  660. ; Requirement:
  661. ; Return Value(s):   Returns the previous Unicode format flag for the control
  662. ; User CallTip:      _GUICtrlStatusBarSetUnicode($h_StatusBar[, $b_Unicode = True[) Sets the Unicode character format flag for the control. (required: <GuiStatusBar.au3>)
  663. ; Author(s):         gafrost (Gary Frost (custompcs at charter dot net))
  664. ; Note(s):
  665. ;===============================================================================
  666. Func _GUICtrlStatusBarSetUnicode($h_StatusBar, $b_Unicode = True)
  667.     If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
  668.     If Not _IsClassName ($h_StatusBar, "msctls_statusbar32") Then Return SetError(-1, -1, False)
  669.     Return _SendMessage($h_StatusBar, $SB_SETUNICODEFORMAT, $b_Unicode)
  670. EndFunc   ;==>_GUICtrlStatusBarSetUnicode
  671.  
  672. ;===============================================================================
  673. ;
  674. ; Description:       _GUICtrlStatusBarShowHide
  675. ; Parameter(s):      hwnd        -    Handle to statusbar
  676. ;                            state        -    @SW_SHOW/@SW_HIDE
  677. ; Requirement:
  678. ; Return Value(s):   If the window was previously visible, the return value is nonzero
  679. ;                            If the window was previously hidden, the return value is zero
  680. ;                    If the function fails, the return value is zero
  681. ; User CallTip:      _GUICtrlStatusBarShowHide(hwnd, state) Show/Hide the StatusBar control. (required: <GuiStatusBar.au3>)
  682. ; Author(s):         gafrost (Gary Frost (custompcs at charter dot net))
  683. ; Note(s):
  684. ;===============================================================================
  685. Func _GUICtrlStatusBarShowHide($h_StatusBar, $i_state)
  686.     If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
  687.     If Not _IsClassName ($h_StatusBar, "msctls_statusbar32") Then Return SetError(-1, -1, 0)
  688.     If $i_state <> @SW_HIDE And $i_state <> @SW_SHOW Then Return SetError(1, 1, 0)
  689.     Local $v_ret = DllCall("user32.dll", "int", "ShowWindow", "hwnd", HWnd($h_StatusBar), "int", $i_state)
  690.     If Not @error And IsArray($v_ret) Then Return $v_ret[0]
  691.     Return SetError(2, 2, 0)
  692. EndFunc   ;==>_GUICtrlStatusBarShowHide
  693.  
  694. ;===============================================================================
  695. ;
  696. ; Description:       _GUICtrlStatusBarSetParts
  697. ; Parameter(s):      $h_GUI             -    Control Id of parent window
  698. ;                            $h_StatusBar    -    The Control Id (will be converted to hWnd)
  699. ;                    $i_Parts        -    Nubmer of parts to create
  700. ;                    $v_PartWidth    -    width of part(s) (Default: 100, can be an array of widths)
  701. ;
  702. ; Requirement:
  703. ; Return Value(s):   1 if successfull, otherwise zero
  704. ; User CallTip:      _GUICtrlStatusBarSetParts ($h_GUI, $h_StatusBar, $i_Parts[, $v_PartWidth = 100]). Sets the number of parts in a status window and the coordinate of the right edge of each part (required: <GuiStatusBar.au3>)
  705. ; Author(s):         tonedef, gafrost (Gary Frost (custompcs at charter dot net)), Steve Podhajecki <gehossafats at netmdc dot com>
  706. ; Note(s):
  707. ;===============================================================================
  708. Func _GUICtrlStatusBarSetParts($h_Gui, $h_StatusBar, $i_parts, $v_PartWidth = 100)
  709.     Local $struct_parts
  710.     
  711.     If IsArray($i_parts) Then Return SetError(1, 1, 0)
  712.     If $i_parts < 1 Then $i_parts = 1
  713.     If IsArray($v_PartWidth) Then $i_parts = UBound($v_PartWidth)
  714.     If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
  715.     If Not _IsClassName ($h_StatusBar, "msctls_statusbar32") Then Return SetError(-1, -1, 0)
  716.     ;=== Set each part to be same size and assign the last one the remainder
  717.     If Not IsArray($v_PartWidth) Then
  718.         Local $a_tPartWidth[$i_parts], $part, $size
  719.         $size = WinGetClientSize($h_Gui)
  720.         For $part = 1 To $i_parts
  721.             $a_tPartWidth[$part - 1] = Int(($size[0] / $i_parts) * $part + 1)
  722.         Next
  723.         $a_tPartWidth[$i_parts - 1] = -1
  724.         $struct_parts = _CreateStuctFromArray($a_tPartWidth, "int")
  725.         If @error Then Return SetError(1, 1, 0)
  726.     Else
  727.         $struct_parts = _CreateStuctFromArray($v_PartWidth, "int")
  728.         If @error Then Return SetError(1, 1, 0)
  729.     EndIf
  730.     ;== end set sizing
  731.     Local $struct_parts_pointer = DllStructGetPtr($struct_parts)
  732.     Local $struct_MemMap
  733.     Local $i_Size = DllStructGetSize($struct_parts)
  734.     Local $Memory_pointer = _MemInit ($h_StatusBar, $i_Size, $struct_MemMap)
  735.     If @error Then
  736.         _MemFree ($struct_MemMap)
  737.         Return SetError(1, 1, 0)
  738.     EndIf
  739.     _MemWrite ($struct_MemMap, $struct_parts_pointer)
  740.     If @error Then
  741.         _MemFree ($struct_MemMap)
  742.         Return SetError(1, 1, 0)
  743.     EndIf
  744.     _SendMessage($h_StatusBar, $SB_SETPARTS, $i_parts, $Memory_pointer)
  745.     If @error Then
  746.         _MemFree ($struct_MemMap)
  747.         Return SetError(1, 1, 0)
  748.     EndIf
  749.     _MemFree ($struct_MemMap)
  750.     If @error Then Return SetError(1, 1, 0)
  751.     _GUICtrlStatusBarResize($h_StatusBar)
  752.     Return 1
  753. EndFunc   ;==>_GUICtrlStatusBarSetParts
  754.  
  755. ;===============================================================================
  756. ; Helper functions
  757. ;===============================================================================
  758. ;===============================================================================
  759. ;
  760. ; Description:       CreateStructFromArray
  761. ; Parameter(s):      $a_Variable array to create struct with
  762. ;                    $structType, the SINGLE type of struct to create.
  763. ; Requirement:
  764. ; Return Value(s):
  765. ; User CallTip:      _CreateStructFromArray
  766. ; Author(s):            Steve Podhajecki <gehossafats at netmdc dot com>
  767. ; Note(s):
  768. ;===============================================================================
  769. Func _CreateStuctFromArray($a_Variable, $structType)
  770.     If Not IsArray($a_Variable) Then Return SetError(1, 1, 0)
  771.     Local $a_ctr, $strVar, $struct
  772. ;~     , $emsg[6]
  773.     For $a_ctr = 0 To UBound($a_Variable) - 1
  774.         $strVar &= $structType & ";"
  775.     Next
  776.     $strVar = StringTrimRight($strVar, 1)
  777. ;~     $emsg[0] = "No Error."
  778. ;~     $emsg[1] = "Variable passed to DllStructCreate was not a string."
  779. ;~     $emsg[2] = "There is an unknown Data Type in the string passed. "
  780. ;~     $emsg[3] = "Failed to allocate the memory needed for the struct, or Pointer = 0."
  781. ;~     $emsg[4] = "Error allocating memory for the passed string."
  782. ;~     $emsg[5] = ""
  783.     
  784.     $struct = DllStructCreate($strVar)
  785.     If @error Then Return SetError(1, 1, 0)
  786.     
  787. ;~     $emsg[0] = 'No Error. '
  788. ;~     $emsg[1] = 'Struct not a correct struct returned by DllStructCreate.'
  789. ;~     $emsg[2] = 'Element value out of range. '
  790. ;~     $emsg[3] = 'index would be outside of the struct.'
  791. ;~     $emsg[4] = 'Element data type is unknown'
  792. ;~     $emsg[5] = 'index < 0.'
  793.     For $a_ctr = 0 To UBound($a_Variable) - 1
  794.         DllStructSetData($struct, ($a_ctr) + 1, $a_Variable[$a_ctr])
  795.         If @error Then Return SetError(1, 1, 0)
  796.     Next
  797.     Return $struct
  798. EndFunc   ;==>_CreateStuctFromArray